package cn.ytr.crm.domain;

import com.alibaba.fastjson.JSON;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.util.HashMap;

@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class Classinfo extends BaseDomain {

    //班级id
    private Long id;

    //班级名称
    private String name;

    //班级人数
    private Integer number;

    //班主任ID
    private Long employeeId;

    //关联员工-班主任-连表查询获得
    private Employee employee;

    //用来返回 json 数据的
    public String getJsonString() {
        HashMap<String, Object> map = new HashMap<>();
        map.put("id", id);
        map.put("name", name);
        map.put("number", number);
        if (employee != null) {
            map.put("employeeId", employee.getId());
        }
        return JSON.toJSONString(map);
    }


}